//
//  ByCommonCache.m
//  beibei_ios
//
//  Created by pro on 16/5/10.
//  Copyright © 2016年 hebidu. All rights reserved.
//

#import "ByCommonCache.h"


#define KEY_USER_INFO @"KEY_USER_INFO"
#define KEY_HOME_DATA @"KEY_HOME_DATA"

@implementation ByCommonCache

#pragma mark - 用户
/** 存储用户信息 */
+ (void)setUserInfo:(ByNetUserModel *)userModel {
    
    [ByCoreCacheSqlite3 setObjectWithKey:KEY_USER_INFO value:userModel expireTime:3600 * 24 * 30];
}
/** 获取用户信息 */
+ (ByNetUserModel *)getUserInfo {

    ByNetUserModel *user = [ByCoreCacheSqlite3 getValueWithKey:KEY_USER_INFO];
    if (user != nil) {
        // 更新数据库中的用户信息 修改update_time
        [self setUserInfo:user];
    }
    
    return user;
}

//#pragma mark - 首页
///** 存储首页数据 */
//+ (void)setHomeData:(ByNetHomeModel *)model {
//    
//    [ByCoreCacheSqlite3 setObjectWithKey:KEY_HOME_DATA value:model expireTime:3600 * 24 * 30];
//
//}
///** 获取首页数据 */
//+ (ByNetHomeModel *)getHomeData {
//    
//    ByNetHomeModel *model = [ByCoreCacheSqlite3 getValueWithKey:KEY_HOME_DATA];
//    return model;
//}

@end
